/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import javax.swing.JLabel;
import javax.swing.JTextField;
import model.Document;
import model.Magazine;

/**
 *
 * @author Ira
 */
public class DocumentPropertiesMagazine extends DocumentPropertiesField {
	
	private JLabel lblNbPage = new JLabel("nbPage");
	private JTextField txtNbPage = new JTextField(13);
	
	public DocumentPropertiesMagazine(boolean editable) {
		super(editable);
		
		this.txtNbPage.setEditable(editable);
		this.add(this.lblNbPage, "w 60!");
		this.add(this.txtNbPage);
	}

	@Override
	public void setContent(Document d) {
		this.txtNbPage.setText("" + ((Magazine)d).getNbPage());
	}

	@Override
	public void getContent(Document d) {
		Magazine mag = (Magazine)d;
		mag.setNbPage(Integer.parseInt(this.txtNbPage.getText()));
	}

	/**
	 * @return the txtNbPage
	 */
	public String getTxtNbPage() {
		return txtNbPage.getText();
	}
}
